package com.chenjiagou.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString

public class Notification {
    private int id;
    private int flightId;
    private String title;
    private String content;
    private LocalDateTime createdAt;


    private boolean isRead; // 是否已读
    private LocalDateTime readTime; // 新增字段
    // 格式化创建时间
    public String getFormattedCreatedAt() {
        return createdAt != null ? createdAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : "";
    }

    // 格式化阅读时间
    public String getFormattedReadTime() {
        return readTime != null ? readTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : "";
    }


}
